<!DOCTYPE html>
  <html>
  <head>
    <title>{{ title }}</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
    :root {
        --github-color: #f0f6fc;
        --githubbj-color: #010409;
    }

    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    body {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        margin: 0;
        background: linear-gradient(120deg, #1a90ff 0%, #003eb3 100%);
        padding: 20px;
    }

    .container {
        text-align: center;
        width: 100%;
        max-width: 800px;
        padding: 0 20px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 70vh;
    }

    .github-corner {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 999;
    }

    .github-corner svg {
        fill: var(githubbj-color);
        color: var(--github-color);
        position: absolute;
        top: 0;
        border: 0;
        right: 0;
        width: 80px;
        height: 80px;
    }

    .github-corner a,
    .github-corner a:visited {
    color: var(--github-color) !important;
    }

    .github-corner a,
    .github-corner a:visited {
    color: transparent !important;
    text-decoration: none !important;
    }

    .github-corner .octo-body,
    .github-corner .octo-arm {
    fill: var(--github-color) !important;
    }

    .github-corner:hover .octo-arm {
        animation: octocat-wave 560ms ease-in-out;
    }

    @keyframes octocat-wave {
        0%, 100% {
        transform: rotate(0);
        }
        20%, 60% {
        transform: rotate(-25deg);
        }
        40%, 80% {
        transform: rotate(10deg);
        }
    }

    .logo {
        margin-bottom: 30px;
        transition: transform 0.3s ease;
    }
    .logo:hover {
        transform: scale(1.05);
    }
    .title {
        color: white;
        font-size: 2em;
        margin-bottom: 10px;
        text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    .subtitle {
        color: rgba(255,255,255,0.9);
        font-size: 1.1em;
        margin-bottom: 30px;
    }
    .download-container {
        display: flex;
        align-items: stretch;
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
        height: 50px;
    }
    #download-input {
        flex: 1;
        padding: 15px 20px;
        font-size: 16px;
        border: none;
        border-radius: 8px 0 0 8px;
        outline: none;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
    }
    #download-input {
        flex: 1;
        padding: 0 20px;
        font-size: 16px;
        border: none;
        border-radius: 8px 0 0 8px;
        outline: none;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
        height: 100%;
    }
    #download-button {
        padding: 0 25px;
        background-color: #0066ff;
        border: none;
        border-radius: 0 8px 8px 0;
        cursor: pointer;
        transition: all 0.3s ease;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    #download-button:hover {
        background-color: #0052cc;
        transform: translateY(-1px);
    }
    #download-button svg {
        width: 24px;
        height: 24px;
    }
    .tips {
        color: rgba(255,255,255,0.8);
        margin-top: 20px;
        font-size: 0.9em;
    }
    .copyright {
        position: fixed;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 14px;
        color: rgba(255,255,255,0.7);
        text-align: center;
    }
    .copyright a {
        color: rgba(255,255,255,0.9);
        text-decoration: none;
        font-weight: bold;
    }
    .copyright a:hover {
        color: white;
        text-decoration: underline;
    }
    @media (max-width: 480px) {
        .container {
        padding: 0 15px;
        min-height: 60vh;
        }
        .github-corner svg {
        width: 60px;
        height: 60px;
        }
        .github-corner:hover .octo-arm {
        animation: none;
        }
        .github-corner .octo-arm {
        animation: octocat-wave 560ms ease-in-out;
        }
        .download-container {
        height: 45px;
        }

        #download-input {
        padding: 0 15px;
        }

        #download-button {
        padding: 0 20px;
        }
    }
    </style>
  </head>
  <body>
    <a href="https://github.com/servless/filetas" target="_blank" class="github-corner" aria-label="View source on Github">
      <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
      </svg>
    </a>
    <div class="container">
        <div class="logo">
            <svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" fill="currentColor" class="bi bi-cloud-arrow-down" viewBox="0 0 16 16">
                <path fill-rule="evenodd" d="M7.646 10.854a.5.5 0 0 0 .708 0l2-2a.5.5 0 0 0-.708-.708L8.5 9.293V5.5a.5.5 0 0 0-1 0v3.793L6.354 8.146a.5.5 0 1 0-.708.708z"/>
                <path d="M4.406 3.342A5.53 5.53 0 0 1 8 2c2.69 0 4.923 2 5.166 4.579C14.758 6.804 16 8.137 16 9.773 16 11.569 14.502 13 12.687 13H3.781C1.708 13 0 11.366 0 9.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383m.653.757c-.757.653-1.153 1.44-1.153 2.056v.448l-.445.049C2.064 6.805 1 7.952 1 9.318 1 10.785 2.23 12 3.781 12h8.906C13.98 12 15 10.988 15 9.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 4.825 10.328 3 8 3a4.53 4.53 0 0 0-2.941 1.1z"/>
            </svg>
        </div>
        <h1 class="title">文件加速下载</h1>
        <p class="subtitle">快速下载网络文件</p>
        <div class="download-container">
            <input type="text" id="download-input" placeholder="请输入下载链接">
            <button id="download-button" title="下载">
                <svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M6 24.0083V42H42V24" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
                    <path d="M33 23L24 32L15 23" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
                    <path d="M23.9917 6V32" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
                </svg>
            </button>
        </div>
        <p class="tips">提示：按回车键执行下载</p>
    </div>
    <div class="copyright">
        <p>
            © 2025 由 Rust + Axum 驱动，基于 <a rel="noopener" class="a-1" href="https://git.jetsung.com/idev/filetas" target="_blank">filetas</a> 构建
        </p>
    </div>
    <script>
    function performDownload() {
        const fileUrl = document.getElementById('download-input').value;
        if (fileUrl) {
			const encodedFileUrl = encodeURIComponent(fileUrl)

			const reqUrl = location.href.slice(0, location.href.lastIndexOf('/') + 1)
            // window.location.href
			window.open(reqUrl + encodedFileUrl)
        }
    }

    document.getElementById('download-button').addEventListener('click', performDownload);
    document.getElementById('download-input').addEventListener('keypress', function(event) {
        if (event.key === 'Enter') {
            performDownload();
        }
    });
    </script>
  </body>
  </html>
